1. Field of the Invention
The present invention relates to a data management system, such as a database, which handles data files and, more particularly, to a data management system and method which are adapted to generate journals or on-line journals or logs at high speed.
2. Description of the Related Art
A data management system which manages data files is required to guarantee four requirements for transactions. The data files here include a relative file, an indexed file, an indexed sequential file, a relational database, a network database, a hierarchical database and so on. A transaction refers to a processing unit involving a set of requests for making a reference to (reading from) and updating (writing into) the data file in order to carry out a certain program. In other words, the transaction refers to a series of operations including entering a message from a terminal, updating a data base and outputting a message to the terminal. The four requirements for transaction are atomicity, consistency, isolation and durability. The atomicity means that the result of a transaction is either success or failure (commitment or cancellation) as a whole. The consistency means that the state of data is changed to a new consistent one at the time of success of the transaction. The isolation is to isolate an intermediate effect of the transaction from another transaction (place it in the invisible state). The durability means the recoverability from a fault.
In order to meet the above four requirements for transaction, a conventional data management system employs a journaling system with the following procedures. When a requesting program makes a request for data access to a data file, it reserves exclusive occupation of data. The exclusive occupation of data means that, even when an access request is made by another program, access to the data is not allowed until the exclusive occupation is released. Subsequently the data is updated on a data buffer secured on main memory and a journal is collected. The journal is then written to a journal file. The updated data on the data buffer is subsequently written to a data file. The exclusive occupation of data is released after the writing of it to the data file. After the exclusive occupation is released, another requesting program is allowed to make a request for data access to the data file.
However, a problem with the journaling system is that a period of the exclusive occupation of data is long. To overcome the problem, a journaling system with the following procedures is proposed by the inventors and will now be considered. According to this journaling system, the exclusive occupation of data is released immediately after the writing of a journal to the journal file. Hence, the exclusive occupation time can be shortened by the time required to write updated data to the data file.
With the above two systems, where a requesting program intends pieces of data to have consistency, the exclusive occupation of these pieces of data is reserved and journals are collected, after that, subsequent processing is performed for the pieces of data.
A recent decrease in memory cost results in an increase in the capacity of main memory of a computer. For this reason, there is a strong possibility that data to be accessed in the data file will be present at the data buffer on the main storage. Thus, in many cases the processes of updating data and collecting journals on the data buffer will depend solely on operations on the main storage.
On the other hand, the process of writing a journal to the journal file and the process of writing updated data on the data buffer to the data file require access to an external storage unit. Access to the external storage unit takes a long time in comparison with operations on the main storage. With the two systems described above, therefore, the data occupation time becomes long.
In the case where many requesting programs run concurrently, when the occupation time of each program is long, the probability of the occurrence of exclusive-occupation contention between the programs increases, so that the system efficiency is decreased.
In the two systems, the writing of journals to the journal file for several requesting programs may be performed at one time. However, this process requires to be performed quickly because it is performed during exclusive occupation time. Thus, there is little possibility that journals can be batch-written (written in a group), and a quantity of data that is batch-written cannot be made large.